<template>
    <div id="cesiumContainer" style="height: 100vh;width: 100vw;position: fixed;z-index: 0;"></div>
    <div id="m_zbz"
        style="position: fixed;width: 128px; height:128px;background-image: url('./img/zbz.png');z-index: 30;right:60px;bottom:40px;pointer-events: none;">
    </div>
    <div v-show="$store.popshow" class="content_info" :style="{ left: positionXy.xAxis + 'px', top: positionXy.yAxis + 'px' }">
        <div>我是弹框</div>
    </div>
    <div>
        <!-- f_AddDanWei()如果url是null则会使用我们本地的绿色底图 -->
        <!-- <el-button style="position: fixed;top: 20px;z-index: 9999;" @click="mapobj.f_AddDanWei('ces',1,'dj',null,[113.11613820098674,35.217676018785255])">添加党建</el-button> -->
    </div>
    <!-- <mapUI></mapUI> -->
</template>
<script setup>
import * as Cesium from 'cesium';
import { onMounted, ref,reactive,watch,onUnmounted } from 'vue';
import cesiumJS from "./mapjs/3Dmap";
import { Delete, Edit, Search, Share, Upload } from '@element-plus/icons-vue';
import axios from 'axios';
import { mainStore } from "./store/index";
import { useRouter } from 'vue-router';
import { ElMessage } from 'element-plus';
const $router =useRouter();
const $store = mainStore();
import mapUI from "./mapui.vue";
import mapobj from "./mapjs/mapObj.js";
import $sys from "./api/api";
const checkInterval =ref(null);
onMounted(() => {
    cesiumJS.setviewer();
    $store.mapObj = cesiumJS;
    // setTimeout(()=>{
    //     cesiumJS.showDigital();

    // },500)
    // cesiumJS.addOutWall();
    // cesiumJS.mapObj.f_Load3DMapData();
    checkInterval.value=setInterval(() => {
        checktoken();
    }, 3000);
});
onUnmounted(()=>{
    clearInterval(checkInterval.value);
})
function checktoken(){
    $sys.checkToken().then(res=>{
        if(res.code==200){
            
        }else{
            ElMessage({
                message:'登录已失效,请重新登陆!',
                type:'warning'
            })
            $router.replace({
                name:'login'
            })
        }
    })     
}
const positionXy = reactive({
    xAxis: 0,
    yAxis: 0
})
function m_setpopup(position) {
    infobox.value = true;
    mapobj.setPopupPos(position);
}
watch(() => $store.xAxis, (nv, ov) => {
    positionXy.xAxis = $store.xAxis;
    positionXy.yAxis = $store.yAxis;
})
</script>
<style scoped>
.content_info {
    border-radius: 3px;
    box-shadow: 0 1px 2px rgba(0, 0, 0, .1);
    /* padding: 10px 10px 15px; */
    position: absolute;
    background-color: rgba(3, 36, 56, 0.6);
    width: 200px;
    z-index: 555;
    font-size: 12px;
    color: white;
}
</style>